﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using Microsoft.Practices.Repository;
using DotNetCore.BannerManagement.Domain;

namespace DotNetCore.BannerManagement.DAL.Domain.dnc_AdvertisementRepositoryArtifacts
{
    /// <summary>
    /// Construct a dnc_Advertisement object from a datareader.
    /// </summary>
    internal class Getdnc_AdvertisementByAdvertiserIDFactory : IDomainObjectFactory<dnc_Advertisement>
    {
        public dnc_Advertisement Construct(IDataReader reader)
        {
			dnc_Advertisement dnc_Advertisement = new dnc_Advertisement();
			
			int activeIndex = reader.GetOrdinal("Active"); 
            if(!reader.IsDBNull(activeIndex))
            {
				dnc_Advertisement.Active= reader.GetBoolean(activeIndex);

			}

			int advertiserIDIndex = reader.GetOrdinal("AdvertiserID"); 
            if(!reader.IsDBNull(advertiserIDIndex))
            {
				dnc_Advertisement.AdvertiserID= reader.GetInt32(advertiserIDIndex);

			}

			int alternateTextIndex = reader.GetOrdinal("AlternateText"); 
            if(!reader.IsDBNull(alternateTextIndex))
            {
				dnc_Advertisement.AlternateText= reader.GetString(alternateTextIndex);

			}

			int endDateIndex = reader.GetOrdinal("EndDate"); 
            if(!reader.IsDBNull(endDateIndex))
            {
				dnc_Advertisement.EndDate= reader.GetDateTime(endDateIndex);
	
			}

			int iDIndex = reader.GetOrdinal("ID"); 
            if(!reader.IsDBNull(iDIndex))
            {
				dnc_Advertisement.ID= reader.GetInt32(iDIndex);

			}

			int imageIDIndex = reader.GetOrdinal("ImageID"); 
            if(!reader.IsDBNull(imageIDIndex))
            {
				dnc_Advertisement.ImageID= reader.GetInt32(imageIDIndex);

			}

			int nameIndex = reader.GetOrdinal("Name"); 
            if(!reader.IsDBNull(nameIndex))
            {
				dnc_Advertisement.Name= reader.GetString(nameIndex);

			}

			int startDateIndex = reader.GetOrdinal("startDate"); 
            if(!reader.IsDBNull(startDateIndex))
            {
				dnc_Advertisement.startDate= reader.GetDateTime(startDateIndex);
	
			}

			int uRLIndex = reader.GetOrdinal("URL"); 
            if(!reader.IsDBNull(uRLIndex))
            {
				dnc_Advertisement.URL= reader.GetString(uRLIndex);

			}

           
			return dnc_Advertisement; 
        }
    }
}

